//    Copyright (C) Kherty.  All rights reserved.
using System;

namespace OpenLS.Spreadsheet.StandardAddIn.Statistics
{
    internal abstract class Distribution
    {
        public static bool IsValidProbabilty(double probability)
        {
            return 0 <= probability && probability <= 1;
        }

        protected static void CheckValidProperty(double probability)
        {
            if (!IsValidProbabilty(probability))
                throw new ArgumentOutOfRangeException("probability");
        }

        public abstract double CumulativeProbability(double x);

        public double CumulativeProbability(double x1, double x2)
        {
            return CumulativeProbability(x2) - CumulativeProbability(x1);
        }
    }
}